package edu.ynu.se.xiecheng.achitectureclass.dao;

import edu.ynu.se.xiecheng.achitectureclass.entity.SoilTemperatureData;
import edu.ynu.se.xiecheng.achitectureclass.entity.Device;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

@Repository
public interface SoilTemperatureRepository extends JpaRepository<SoilTemperatureData, Long> {
    Optional<SoilTemperatureData> findFirstByOrderByCreateTimeDesc();
    List<SoilTemperatureData> findByCreateTimeBetween(LocalDateTime start, LocalDateTime end);
    List<SoilTemperatureData> findByDeviceAndCreateTimeBetween(Device device, LocalDateTime start, LocalDateTime end);
} 